package com.bzkj.web.controller.basic;

import com.bzkj.basicinfo.domain.basic.BasicPicType;
import com.bzkj.basicinfo.service.basic.BasicPicTypeService;
import com.bzkj.common.annotation.LogC;
import com.bzkj.common.core.controller.BaseController;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.core.page.TableDataInfo;
import com.bzkj.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "图标类型")
@RestController
@RequestMapping("basic/picType")
public class BasicPicTypeController extends BaseController
{

    @Autowired
    private BasicPicTypeService basicPicTypeService;

    /**
     * 获取图标类型
     *
     * @param entity
     * @return
     */
    @ApiOperation("查询接口")
    @GetMapping("findBasicPicTypeData")
    public TableDataInfo findBasicPicTypeData(BasicPicType entity)
    {
        startPage();
        return getDataTable(basicPicTypeService.findBasicPicTypeData(entity));
    }

    /**
     * 修改图标类型
     *
     * @param entity
     * @return
     */
    @ApiOperation("修改接口")
    @PutMapping("updateBasicPicType")
    @LogC(title = "ncc图标类型信息", businessType = BusinessType.UPDATE,
            tableNames = "basic_pic_type", pkFieldNames = "pic_type_id", content = "' 图标类型名称：'+#entity.picTypeName")
    public AjaxResult updateBasicPicType(@RequestBody BasicPicType entity)
    {
        return basicPicTypeService.updateBasicPicType(entity);
    }

    /**
     * 新增图标类型
     *
     * @param entity
     * @return
     */
    @ApiOperation("新增接口")
    @PostMapping("basicPicTypeSave")
    @LogC(title = "ncc图标类型信息", businessType = BusinessType.INSERT,
            tableNames = "basic_pic_type", pkFieldNames = "pic_type_id", content = "' 图标类型名称：'+#entity.picTypeName")
    public AjaxResult basicPicTypeSave(@RequestBody BasicPicType entity)
    {
        return basicPicTypeService.basicPicTypeSave(entity);
    }

    /**
     * 获取所有图标类型
     *
     * @return
     */
    @GetMapping("findBasicPicTypeAll")
    public R findBasicPicTypeAll()
    {
        return basicPicTypeService.findBasicPicTypeAll();
    }

    @DeleteMapping("/delete")
    public AjaxResult deleteById(String id){
        return basicPicTypeService.deleteBasicPicType(id);
    }

}
